/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mscs.server.promotion.logic;

import java.text.SimpleDateFormat;
import java.util.Vector;
import mscs.data.IGoodsGiftProxy;
import mscs.data.IToStringArrayCallBack;
import mscs.data.pojo.GoodsGift;

/**
 *
 * @author Usbuild
 */
public class GoodsGiftUtil extends GiftDiscountUtil<GoodsGift>{
    public GoodsGiftUtil() {
        super(new IGoodsGiftProxy());
    }

    @Override
    public Vector<Vector<String>> toDataVector() {
        return toDataVector(new GoodsGiftCallback());
    }
    
}
class GoodsGiftCallback implements IToStringArrayCallBack {

    public Vector<String> toStringArray(Object obj) {
        if(obj != null) {
            GoodsGift goodsGift = (GoodsGift)obj;
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Vector<String> stringArray = new Vector<String>();
            stringArray.add(goodsGift.getGoodsID());
            stringArray.add(goodsGift.getGiftID());
            stringArray.add(String.valueOf(goodsGift.getGiftSum()));
            stringArray.add(sdf.format(goodsGift.getStartDate()));
            stringArray.add(sdf.format(goodsGift.getEndDate()));
            return stringArray;
        }
        return null;
    }
    
}
